package com.itheima.stock.xxljob;

import com.itheima.stock.service.StockTimerTaskService;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;


@Component
public class StockJob {
    private static Logger logger = LoggerFactory.getLogger(StockJob.class);

    @Autowired
    private StockTimerTaskService stockTimerTaskService;

    @XxlJob("xxlJob_Test")
    public void jobTest(){
        System.out.println("jobTest run.....");
    }

    /**
     * 每周1到周5，上午九点半到11点半，下午1点到3点的流水数据
     * 定义每分钟获取一次国内大盘数据
     */
    @XxlJob("stock_inner_market")
    public void getStockAMarketTask() {
        stockTimerTaskService.getInnerMarketInfo();
    }

    /**
     * 定时采集A股数据
     */
    @XxlJob("getStockInfos")
    public void getStockInfos() {
        stockTimerTaskService.getStockRtIndex();
    }

    /**
     * 板块定时任务
     */
    @XxlJob("getStockBlockInfoTask")
    public void getStockBlockInfoTask() {
        stockTimerTaskService.getStockSectorRtIndex();
    }

}
